#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2022/1/28 15:22
# @Author  : ldh

from basic.device.Android import Android


class trends_page(Android) :
    btm = "cn.cloudbae.loveguangxi:id/tvLivePay"
    empty_show_text = "cn.cloudbae.loveguangxi:id/empty_show_text"
    source = "cn.cloudbae.loveguangxi:id/tv_dynamic_source"

    # 打开动态页
    @classmethod
    def open_trends(cls) :
        cls.poco(cls.btm)[3].click()

    # 判断消息是否为空
    @classmethod
    def ifempty_trends(cls) :
        if cls.poco(cls.empty_show_text).exists() :
            print("暂无消息，点击刷新获取数据！")
            return True
        else :
            return False

    # 动态消息校验
    @classmethod
    def check_trends(cls) :
        source = cls.poco(cls.source)[0].get_text()
        print("消息来源:" + source)
        return source
